﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;

namespace Assignment3.Entities
{
    class Car : Entity
    {
        public Car(Camera camera) : base(camera)
        {
        }

        public override void Draw()
        {
            foreach (ModelMesh mesh in Model.Meshes)
            {
                foreach (ModelMeshPart part in mesh.MeshParts)
                {
                    part.Effect = Effects["Basic"];

                    ((BasicEffect)Effects["Basic"]).Texture = Texture;
                    ((BasicEffect)Effects["Basic"]).TextureEnabled = true;

                    ((BasicEffect)Effects["Basic"]).World = ObjectWorld;
                    ((BasicEffect)Effects["Basic"]).View = Camera.View;
                    ((BasicEffect)Effects["Basic"]).Projection = Camera.Projection;

                    part.Effect.CurrentTechnique.Passes[0].Apply();
                }
                mesh.Draw();
            }
        }
    }
}
